#ifndef LOG_H
#define LOG_H

#define LOG_LEVEL_DEBUG 0
#define LOG_LEVEL_INFO  1
#define LOG_LEVEL_ERROR 2

// 当前日志等级
#define CURRENT_LOG_LEVEL LOG_LEVEL_INFO
// 日志模块初始化
#define LOG_INIT Serial.begin(9600);
// 调试日志
#define LOG_DEBUG(msg) do { if (CURRENT_LOG_LEVEL <= LOG_LEVEL_DEBUG) { Serial.print("[DEBUG] "); Serial.println(msg); } } while(0)
// 运行日志
#define LOG_INFO(msg)  do { if (CURRENT_LOG_LEVEL <= LOG_LEVEL_INFO)  { Serial.print("[INFO] "); Serial.println(msg); } } while(0)
// 错误日志
#define LOG_ERROR(msg) do { if (CURRENT_LOG_LEVEL <= LOG_LEVEL_ERROR) { Serial.print("[ERROR] "); Serial.println(msg); } } while(0)

#endif